Optimal. Leaf size=447 \[ -\frac {(i A+B-i C) \tanh ^{-1}\left (\frac {\sqrt {c+d \tan (e+f x)}}{\sqrt {c-i d}}\right )}{(a-i b)^2 (c-i d)^{3/2} f}-\frac {(B-i (A-C)) \tanh ^{-1}\left (\frac {\sqrt {c+d \tan (e+f x)}}{\sqrt {c+i d}}\right )}{(a+i b)^2 (c+i d)^{3/2} f}-\frac {\sqrt {b} \left (5 a^3 b B d-3 a^4 C d+b^4 (2 B c-3 A d)+a b^3 (4 A c-4 c C+B d)-a^2 b^2 (2 B c+(7 A-C) d)\right ) \tanh ^{-1}\left (\frac {\sqrt {b} \sqrt {c+d \tan (e+f x)}}{\sqrt {b c-a d}}\right )}{\left (a^2+b^2\right )^2 (b c-a d)^{5/2} f}-\frac {d \left (2 b^2 c (c C-B d)-a b B \left (c^2+d^2\right )+a^2 \left (3 c^2 C-2 B c d+C d^2\right )+A \left (2 a^2 d^2+b^2 \left (c^2+3 d^2\right )\right )\right )}{\left (a^2+b^2\right ) (b c-a d)^2 \left (c^2+d^2\right ) f \sqrt {c+d \tan (e+f x)}}-\frac {A b^2-a (b B-a C)}{\left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x)) \sqrt {c+d \tan (e+f x)}} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 1.92, antiderivative size = 446, normalized size of antiderivative = 1.00, number of steps
used = 13, number of rules used = 7, integrand size = 47, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.149, Rules used = {3730, 3734,
3620, 3618, 65, 214, 3715} \begin {gather*} -\frac {d \left (2 a^2 A d^2+a^2 \left (-2 B c d+3 c^2 C+C d^2\right )-a b B \left (c^2+d^2\right )+A b^2 \left (c^2+3 d^2\right )+2 b^2 c (c C-B d)\right )}{f \left (a^2+b^2\right ) \left (c^2+d^2\right ) (b c-a d)^2 \sqrt {c+d \tan (e+f x)}}-\frac {A b^2-a (b B-a C)}{f \left (a^2+b^2\right ) (b c-a d) (a+b \tan (e+f x)) \sqrt {c+d \tan (e+f x)}}-\frac {\sqrt {b} \left (-3 a^4 C d+5 a^3 b B d-a^2 b^2 (d (7 A-C)+2 B c)+a b^3 (4 A c+B d-4 c C)+b^4 (2 B c-3 A d)\right ) \tanh ^{-1}\left (\frac {\sqrt {b} \sqrt {c+d \tan (e+f x)}}{\sqrt {b c-a d}}\right )}{f \left (a^2+b^2\right )^2 (b c-a d)^{5/2}}-\frac {(i A+B-i C) \tanh ^{-1}\left (\frac {\sqrt {c+d \tan (e+f x)}}{\sqrt {c-i d}}\right )}{f (a-i b)^2 (c-i d)^{3/2}}-\frac {(B-i (A-C)) \tanh ^{-1}\left (\frac {\sqrt {c+d \tan (e+f x)}}{\sqrt {c+i d}}\right )}{f (a+i b)^2 (c+i d)^{3/2}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 65
Rule 214
Rule 3618
Rule 3620
Rule 3715
Rule 3730
Rule 3734
Rubi steps
\begin {align*} \int \frac {A+B \tan (e+f x)+C \tan ^2(e+f x)}{(a+b \tan (e+f x))^2 (c+d \tan (e+f x))^{3/2}} \, dx &=-\frac {A b^2-a (b B-a C)}{\left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x)) \sqrt {c+d \tan (e+f x)}}-\frac {\int \frac {\frac {1}{2} \left (3 A b^2 d-2 a A (b c-a d)-(b B-a C) (2 b c+a d)\right )+(A b-a B-b C) (b c-a d) \tan (e+f x)+\frac {3}{2} \left (A b^2-a (b B-a C)\right ) d \tan ^2(e+f x)}{(a+b \tan (e+f x)) (c+d \tan (e+f x))^{3/2}} \, dx}{\left (a^2+b^2\right ) (b c-a d)}\\ &=-\frac {d \left (2 a^2 A d^2+2 b^2 c (c C-B d)-a b B \left (c^2+d^2\right )+A b^2 \left (c^2+3 d^2\right )+a^2 \left (3 c^2 C-2 B c d+C d^2\right )\right )}{\left (a^2+b^2\right ) (b c-a d)^2 \left (c^2+d^2\right ) f \sqrt {c+d \tan (e+f x)}}-\frac {A b^2-a (b B-a C)}{\left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x)) \sqrt {c+d \tan (e+f x)}}-\frac {2 \int \frac {\frac {1}{4} \left (-2 a^3 d^2 (A c-c C+B d)+a^2 b (4 A-C) d \left (c^2+d^2\right )-b^3 (2 B c-3 A d) \left (c^2+d^2\right )+a b^2 \left (2 c^3 C+B c^2 d+4 c C d^2-B d^3-2 A \left (c^3+2 c d^2\right )\right )\right )+\frac {1}{2} (b c-a d)^2 (A b c-a B c-b c C+a A d+b B d-a C d) \tan (e+f x)+\frac {1}{4} b d \left (2 a^2 A d^2+2 b^2 c (c C-B d)-a b B \left (c^2+d^2\right )+A b^2 \left (c^2+3 d^2\right )+a^2 \left (3 c^2 C-2 B c d+C d^2\right )\right ) \tan ^2(e+f x)}{(a+b \tan (e+f x)) \sqrt {c+d \tan (e+f x)}} \, dx}{\left (a^2+b^2\right ) (b c-a d)^2 \left (c^2+d^2\right )}\\ &=-\frac {d \left (2 a^2 A d^2+2 b^2 c (c C-B d)-a b B \left (c^2+d^2\right )+A b^2 \left (c^2+3 d^2\right )+a^2 \left (3 c^2 C-2 B c d+C d^2\right )\right )}{\left (a^2+b^2\right ) (b c-a d)^2 \left (c^2+d^2\right ) f \sqrt {c+d \tan (e+f x)}}-\frac {A b^2-a (b B-a C)}{\left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x)) \sqrt {c+d \tan (e+f x)}}-\frac {2 \int \frac {-\frac {1}{2} (b c-a d)^2 \left (a^2 (A c-c C+B d)-b^2 (A c-c C+B d)+2 a b (B c-(A-C) d)\right )+\frac {1}{2} (b c-a d)^2 \left (2 a b (A c-c C+B d)-a^2 (B c-(A-C) d)+b^2 (B c-(A-C) d)\right ) \tan (e+f x)}{\sqrt {c+d \tan (e+f x)}} \, dx}{\left (a^2+b^2\right )^2 (b c-a d)^2 \left (c^2+d^2\right )}-\frac {\left (2 \left (-\frac {1}{2} a b (b c-a d)^2 (A b c-a B c-b c C+a A d+b B d-a C d)+\frac {1}{4} a^2 b d \left (2 a^2 A d^2+2 b^2 c (c C-B d)-a b B \left (c^2+d^2\right )+A b^2 \left (c^2+3 d^2\right )+a^2 \left (3 c^2 C-2 B c d+C d^2\right )\right )+\frac {1}{4} b^2 \left (-2 a^3 d^2 (A c-c C+B d)+a^2 b (4 A-C) d \left (c^2+d^2\right )-b^3 (2 B c-3 A d) \left (c^2+d^2\right )+a b^2 \left (2 c^3 C+B c^2 d+4 c C d^2-B d^3-2 A \left (c^3+2 c d^2\right )\right )\right )\right )\right ) \int \frac {1+\tan ^2(e+f x)}{(a+b \tan (e+f x)) \sqrt {c+d \tan (e+f x)}} \, dx}{\left (a^2+b^2\right )^2 (b c-a d)^2 \left (c^2+d^2\right )}\\ &=-\frac {d \left (2 a^2 A d^2+2 b^2 c (c C-B d)-a b B \left (c^2+d^2\right )+A b^2 \left (c^2+3 d^2\right )+a^2 \left (3 c^2 C-2 B c d+C d^2\right )\right )}{\left (a^2+b^2\right ) (b c-a d)^2 \left (c^2+d^2\right ) f \sqrt {c+d \tan (e+f x)}}-\frac {A b^2-a (b B-a C)}{\left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x)) \sqrt {c+d \tan (e+f x)}}+\frac {(A-i B-C) \int \frac {1+i \tan (e+f x)}{\sqrt {c+d \tan (e+f x)}} \, dx}{2 (a-i b)^2 (c-i d)}+\frac {(A+i B-C) \int \frac {1-i \tan (e+f x)}{\sqrt {c+d \tan (e+f x)}} \, dx}{2 (a+i b)^2 (c+i d)}-\frac {\left (2 \left (-\frac {1}{2} a b (b c-a d)^2 (A b c-a B c-b c C+a A d+b B d-a C d)+\frac {1}{4} a^2 b d \left (2 a^2 A d^2+2 b^2 c (c C-B d)-a b B \left (c^2+d^2\right )+A b^2 \left (c^2+3 d^2\right )+a^2 \left (3 c^2 C-2 B c d+C d^2\right )\right )+\frac {1}{4} b^2 \left (-2 a^3 d^2 (A c-c C+B d)+a^2 b (4 A-C) d \left (c^2+d^2\right )-b^3 (2 B c-3 A d) \left (c^2+d^2\right )+a b^2 \left (2 c^3 C+B c^2 d+4 c C d^2-B d^3-2 A \left (c^3+2 c d^2\right )\right )\right )\right )\right ) \text {Subst}\left (\int \frac {1}{(a+b x) \sqrt {c+d x}} \, dx,x,\tan (e+f x)\right )}{\left (a^2+b^2\right )^2 (b c-a d)^2 \left (c^2+d^2\right ) f}\\ &=-\frac {d \left (2 a^2 A d^2+2 b^2 c (c C-B d)-a b B \left (c^2+d^2\right )+A b^2 \left (c^2+3 d^2\right )+a^2 \left (3 c^2 C-2 B c d+C d^2\right )\right )}{\left (a^2+b^2\right ) (b c-a d)^2 \left (c^2+d^2\right ) f \sqrt {c+d \tan (e+f x)}}-\frac {A b^2-a (b B-a C)}{\left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x)) \sqrt {c+d \tan (e+f x)}}+\frac {(i A+B-i C) \text {Subst}\left (\int \frac {1}{(-1+x) \sqrt {c-i d x}} \, dx,x,i \tan (e+f x)\right )}{2 (a-i b)^2 (c-i d) f}-\frac {(i (A+i B-C)) \text {Subst}\left (\int \frac {1}{(-1+x) \sqrt {c+i d x}} \, dx,x,-i \tan (e+f x)\right )}{2 (a+i b)^2 (c+i d) f}-\frac {\left (4 \left (-\frac {1}{2} a b (b c-a d)^2 (A b c-a B c-b c C+a A d+b B d-a C d)+\frac {1}{4} a^2 b d \left (2 a^2 A d^2+2 b^2 c (c C-B d)-a b B \left (c^2+d^2\right )+A b^2 \left (c^2+3 d^2\right )+a^2 \left (3 c^2 C-2 B c d+C d^2\right )\right )+\frac {1}{4} b^2 \left (-2 a^3 d^2 (A c-c C+B d)+a^2 b (4 A-C) d \left (c^2+d^2\right )-b^3 (2 B c-3 A d) \left (c^2+d^2\right )+a b^2 \left (2 c^3 C+B c^2 d+4 c C d^2-B d^3-2 A \left (c^3+2 c d^2\right )\right )\right )\right )\right ) \text {Subst}\left (\int \frac {1}{a-\frac {b c}{d}+\frac {b x^2}{d}} \, dx,x,\sqrt {c+d \tan (e+f x)}\right )}{\left (a^2+b^2\right )^2 d (b c-a d)^2 \left (c^2+d^2\right ) f}\\ &=-\frac {\sqrt {b} \left (5 a^3 b B d-3 a^4 C d+b^4 (2 B c-3 A d)+a b^3 (4 A c-4 c C+B d)-a^2 b^2 (2 B c+7 A d-C d)\right ) \tanh ^{-1}\left (\frac {\sqrt {b} \sqrt {c+d \tan (e+f x)}}{\sqrt {b c-a d}}\right )}{\left (a^2+b^2\right )^2 (b c-a d)^{5/2} f}-\frac {d \left (2 a^2 A d^2+2 b^2 c (c C-B d)-a b B \left (c^2+d^2\right )+A b^2 \left (c^2+3 d^2\right )+a^2 \left (3 c^2 C-2 B c d+C d^2\right )\right )}{\left (a^2+b^2\right ) (b c-a d)^2 \left (c^2+d^2\right ) f \sqrt {c+d \tan (e+f x)}}-\frac {A b^2-a (b B-a C)}{\left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x)) \sqrt {c+d \tan (e+f x)}}-\frac {(A-i B-C) \text {Subst}\left (\int \frac {1}{-1-\frac {i c}{d}+\frac {i x^2}{d}} \, dx,x,\sqrt {c+d \tan (e+f x)}\right )}{(a-i b)^2 (c-i d) d f}-\frac {(A+i B-C) \text {Subst}\left (\int \frac {1}{-1+\frac {i c}{d}-\frac {i x^2}{d}} \, dx,x,\sqrt {c+d \tan (e+f x)}\right )}{(a+i b)^2 (c+i d) d f}\\ &=-\frac {(i A+B-i C) \tanh ^{-1}\left (\frac {\sqrt {c+d \tan (e+f x)}}{\sqrt {c-i d}}\right )}{(a-i b)^2 (c-i d)^{3/2} f}-\frac {(B-i (A-C)) \tanh ^{-1}\left (\frac {\sqrt {c+d \tan (e+f x)}}{\sqrt {c+i d}}\right )}{(a+i b)^2 (c+i d)^{3/2} f}-\frac {\sqrt {b} \left (5 a^3 b B d-3 a^4 C d+b^4 (2 B c-3 A d)+a b^3 (4 A c-4 c C+B d)-a^2 b^2 (2 B c+7 A d-C d)\right ) \tanh ^{-1}\left (\frac {\sqrt {b} \sqrt {c+d \tan (e+f x)}}{\sqrt {b c-a d}}\right )}{\left (a^2+b^2\right )^2 (b c-a d)^{5/2} f}-\frac {d \left (2 a^2 A d^2+2 b^2 c (c C-B d)-a b B \left (c^2+d^2\right )+A b^2 \left (c^2+3 d^2\right )+a^2 \left (3 c^2 C-2 B c d+C d^2\right )\right )}{\left (a^2+b^2\right ) (b c-a d)^2 \left (c^2+d^2\right ) f \sqrt {c+d \tan (e+f x)}}-\frac {A b^2-a (b B-a C)}{\left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x)) \sqrt {c+d \tan (e+f x)}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice
the leaf count of optimal. \(2078\) vs. \(2(447)=894\).
time = 6.22, size = 2078, normalized size = 4.65 \begin {gather*} \text {Result too large to show} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(10087\) vs.
\(2(411)=822\).
time = 0.65, size = 10088, normalized size = 22.57
method | result | size |
derivativedivides | \(\text {Expression too large to display}\) | \(10088\) |
default | \(\text {Expression too large to display}\) | \(10088\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: TypeError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F(-1)]
time = 0.00, size = -1, normalized size = -0.00 \begin {gather*} \text {Hanged} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________